<template>
    <div
      class="xtx-skeleton shan"
      :style="{ width: '60px', height: '30px' }"
    >
      <!-- 1 盒子-->
      <div class="block" :style="{ backgroundColor: '#efefef'}"></div>
      <!-- 2 闪效果 xtx-skeleton 伪元素 --->
    </div>
  </template>
  <script>
  export default {
    name: 'XtxSkeleton'
  }
  </script>
  <style scoped lang="scss">
  .xtx-skeleton {
    display: inline-block;
    position: relative;
    overflow: hidden;
    vertical-align: middle;
    .block {
      width: 100%;
      height: 100%;
      border-radius: 2px;
    }
  }
  .shan {
    &::after {
      content: "";
      position: absolute;
      animation: shan 1.5s ease 0s infinite;
      top: 0;
      width: 50%;
      height: 100%;
      background: linear-gradient(
        to left,
        rgba(113, 110, 110, 0) 0,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0) 100%
      );
      transform: skewX(-45deg);
    }
  }
  @keyframes shan {
    0% {
      left: -100%;
    }
    100% {
      left: 120%;
    }
  }
  </style>